const COLUMNS = [
	{prop:"position", label:"职位",width:"200"},
	{prop:"positionmoney", label:"岗位工资",width:"200"}
];
const Xiangmurules= {
	position: [{
			required: true,
			message: '请选择职位',
			trigger: 'blur'
		}],
	positionmoney: [{
			required: true,
			message: '请输入金额',
			trigger: 'blur'
		}]				
	};
	
	
	
let app = new Vue({
    el: "#app",
    data() {
        return {
        	leftbar_show:true,
			tableHeight:window.innerHeight - 180,
			queryForm:{
				pageNo:1, // 当前页码
				pagesize:100 ,// 每页记录数
				pagesizes:[10,20,50,100,500]				
			},
			pagetotal:0,

			importForm: {
			
			},			
			form: {name: '',region: '',date1: ''},																				
			pagedata:[],  // 当前页结果集
			positions:[],//职位
			action:" ",
			tablecolums:COLUMNS,
			submitDisable: false,
			innerVisible: false,
			imgdialogVisible:false,
			tabdistributevalue: "base",
			dialogimportFormVisible :false,
			addSalary: true,
			imgdialogImageUrl:''
        }
    },
	methods: {
		// 显示侧边栏
		showLeftBar() {
			if (this.leftbar_show) {
				this.leftbar_show = false
			} else {
				this.leftbar_show = true
			}
		},	

		 onSubmit() {
		        console.log('submit!');
		      },
		selectionChange(selection){
			this.selection = selection
		},
		handleSelectionChange(val) {
			this.multipleSelection = val;
		},
		toolAction(acName) {
			if (acName == "编辑") {
				this.edit()
			} 
		},			  
		async confirmService() {
			this.$refs.importForm.validate(async valid => {
				if (valid) {
					const loading = this.$loading(LOAD_STYLE);
					try {
						let res = await axios.put('api/keepaccount/editcus', this.importForm);
						if (res.code === 200) {
							this.dialogEditBaseFormVisible = false
							this.query()
							this.$message.success(res.message);
						} else {
							this.$message.error(res.message);
						}
					} catch (e) {
						this.$message.error('请求出错！', e.message);
					}
					// 关闭加载框
					loading.close();
				}
			})
		},
		// 查询
		async query() {
			// 显示加载框
			const loading = this.$loading(LOAD_STYLE);
			try {
				let res = await axios.post('api/payform/query', this.queryForm);
				if (res.code === 200) {
					this.pagedata = res.data;
					this.pagetotal = res.total;
					this.$message.success(res.message);
				}else {
					this.$message.error(res.message);
				}
			}catch (e) {
				this.$message.error('查询请求出错！', e.message);
			}
			
			// 关闭加载框
			loading.close();
		},



		// 设定表格当前页
		handleCurrentPageChange (selectedPageNo) {
		  this.queryForm.pageNo = selectedPageNo
		  // 加载数据页
		  this.query()
		},

	},
	async mounted() {
		// 自动调整表格高度
		window.onresize = () => {
		  return (() => {
			this.tableHeight = window.innerHeight - 180
		  })()
		}

	}
});	